package io.cici.cc.mybatis.lite.builder;

import io.cici.cc.mybatis.lite.mapping.ResultMapping;
import io.cici.cc.mybatis.lite.mapping.ResultMappings;

import java.util.List;

public class ResultMapResolver {
    private final MapperBuilder mapperBuilder;
    private final String id;
    private final Class<?> type;

    private final List<ResultMapping> resultMappings;

    public ResultMapResolver(MapperBuilder mapperBuilder, String id, Class<?> type,
                             List<ResultMapping> resultMappings) {
        this.mapperBuilder = mapperBuilder;
        this.id = id;
        this.type = type;

        this.resultMappings = resultMappings;
    }

    public ResultMappings resolve() {
        return mapperBuilder.addResultMap(this.id, this.type, this.resultMappings);
    }

}
